<template>
    <div class="internalControl-budget-ledger-div-box">
        <vxe-toolbar>
            <template #buttons>
                <div class="internalControl-budget-ledger-form-box">
                    <a-form layout="inline" :form="form">
                        <a-form-item label="预算项目名称">
                            <a-input placeholder="请输入" v-model="formState.fysxmmc"></a-input>
                        </a-form-item>
                        <a-form-item label="科室">
                            <compSelector
                            :key="compSelectorkey"
                            v-model="formState.fbm"
                            :defaultValue="formState.fbm"
                            :compType="typeSelect"
                            class="comp-select-box-b"
                            dictionaryType="OA申请科室单位"/>
                        </a-form-item>
                        <a-form-item label="功能分类">
                            <compSelector
                            :key="compSelectorkey"
                            v-model="formState.fgnflbm"
                            :defaultValue="formState.fgnflbm"
                            :compType="typeSelect"
                            class="comp-select-box-b"
                            dictionaryType="功能分类"/>
                        </a-form-item>
                        <a-form-item label="支付时间">
                            <a-range-picker :value="createValue" @change="onChange" />
                        </a-form-item>
                        <a-form-item label="预算项目">
                            <a-input placeholder="请输入" v-model="formState.fyslymc"></a-input>
                        </a-form-item>
                        <a-form-item label="金额">
                            <a-input-number v-model="formState.minFzzb" style="width: 46%"/>
                            <span style="width: 8%;"> - </span>
                            <a-input-number v-model="formState.maxFzzb" style="width: 46%;"/>
                        </a-form-item>
                        <a-form-item label="部门经济分类">
                            <a-cascader ref="cascaderBm" :display-render="displayRender" :options="bmJjflList" placeholder="请选择" @change="onBmflChange" />
                        </a-form-item>
                        <!-- <a-form-item label="每页条数">
                            <a-select  v-model="formState.pageSize" default-value="10" @change="handleChange">
                                <a-select-option value="10">
                                10
                                </a-select-option>
                                <a-select-option value="20">
                                20
                                </a-select-option>
                                <a-select-option value="50">
                                50
                                </a-select-option>
                                <a-select-option value="100">
                                100
                                </a-select-option>
                            </a-select>
                        </a-form-item> -->
                        <a-form-item label="是否政府采购">
                            <a-radio-group name="radioGroup" v-model="formState.fsfzfcg">
                            <a-radio value="是">
                                是
                            </a-radio>
                            <a-radio value="否">
                                否
                            </a-radio>
                            </a-radio-group>
                        </a-form-item>
                        <!-- <a-form-item label="关键字">
                            <a-input placeholder="请输入" v-model="formState.fzbzy"></a-input>
                        </a-form-item> -->
                        <a-form-item label="政府经济分类">
                            <a-cascader ref="cascaderZf" :display-render="displayRender" :options="zfJjflList" placeholder="请选择" @change="onZfflChange" />
                        </a-form-item>
                        <a-form-item>
                            <a-button class="blue-btn" @click="getData" icon="search" style="margin-right: 10px;">查询</a-button>
                            <a-button @click="clearData" icon="reload">重置</a-button>
                        </a-form-item>
                    </a-form>
                    <div style="text-align: right;">
                        <a-button class="blue-btn" @click="addHandele" icon="plus" style="margin-right: 10px;">添加</a-button>
                        <a-button class="blue-btn" @click="downloadModel" icon="vertical-align-bottom" style="margin-right: 10px;">下载模板</a-button>
                        <a-upload style="display: inline-block;" :showUploadList="false" :beforeUpload="beforeUpload" action="" @change="importHandele">
                            <a-button class="blue-btn" icon="import" style="margin-right: 10px;">导入</a-button>
                        </a-upload>
                        <a-button class="blue-btn" @click="exportHandele" icon="export" style="margin-right: 10px;">导出</a-button>
                    </div>
                </div>
                <div style="width: 100%;">
                    <div style="padding-left:10px;flex: 2;font-size: 16px;font-family: '宋体', sans-serif;">
                        <span style="margin-right: 10px;">总指标：<span style="color: #00BFFF;">{{ tzjdData.fzzb }}</span></span>
                        <span style="margin-right: 10px;">指标结余：<span style="color: #66c24f;">{{ tzjdData.fzbjy }}</span></span>
                        <span>支出进度：<span style="color: #FF3030;">{{ tzjdData.fzcjd }}</span></span>
                    </div>
                    <div style="padding-left:10px;flex: 2;font-size: 16px;font-family: '宋体', sans-serif;">
                        <span style="margin-right: 10px;">当前页总指标：<span style="color: #00BFFF;">{{ tzjdDataPage.fzzb }}</span></span>
                        <span style="margin-right: 10px;">当前页指标结余：<span style="color: #66c24f;">{{ tzjdDataPage.fzbjy }}</span></span>
                        <span>当前页支出进度：<span style="color: #FF3030;">{{ tzjdDataPage.fzcjd }}</span></span>
                    </div>
                </div>
            </template>
          <!-- <template #tools>

          </template> -->
        </vxe-toolbar>
        <vxe-table
            keep-source
            border
            ref="tableRef"
            :row-config="{keyField: 'id'}"
            :column-config="{resizable: true}"
            :print-config="{}"
            :export-config="{}"
            :loading="loading"
            :tree-config="{transform: true, rowField: 'id', parentField: 'parentid',expandAll: true}"
            :edit-config="{trigger: 'click', mode: 'row', showStatus: true}"
            :expand-config="{reserve: true}"
            :data="tableData"
            :height="ledgerTableHeight"
            :scroll-y="{enabled: false}"
            @checkbox-all="selectChangeEvent"
            @checkbox-change="selectChangeEvent"
            class="internalControl-ledger-table">
            <vxe-column type="checkbox" width="60" fixed="left"></vxe-column>
            <vxe-column field="fxh" title="序号" width="50" fixed="left"></vxe-column>
            <vxe-column field="fysxmmc" title="预算项目名称" tree-node width="200" fixed="left">
              <template #default="{ row }">
                <span v-if="row.parentid" style="color: #5ca3e5;" @click="viewChaiLogs(row)">{{ row.fysxmmc }}</span>
                <span v-else>{{ row.fysxmmc }}</span>
              </template>
            </vxe-column>
            <vxe-column field="fzcxmlbbm" title="支出项目类别编码" width="120"></vxe-column>
            <vxe-column field="fzcxmlbmc" title="支出项目类别名称" width="120"></vxe-column>
            <vxe-column field="fgnflbm" title="功能分类编码" width="120"></vxe-column>
            <vxe-column field="fgnflmc" title="功能分类名称" width="120"></vxe-column>
            <vxe-column field="fzfjjflbm" title="政府经济分类编码" width="120"></vxe-column>
            <vxe-column field="fzfjjflmc" title="政府经济分类名称" width="120"></vxe-column>
            <vxe-column field="fbmjjflbm" title="部门经济分类编码" width="120"></vxe-column>
            <vxe-column field="fbmjjflmc" title="部门经济分类名称" width="120"></vxe-column>
            <vxe-column field="fzbzy" title="指标摘要" width="150"></vxe-column>
            <vxe-column field="fsfzfcg" title="是否政府采购" width="100"></vxe-column>
            <vxe-column field="fzzb" title="总指标" width="100"></vxe-column>
            <vxe-column field="fyzfje" title="已支付金额" width="100"></vxe-column>
            <vxe-column field="fzbjy" title="指标结余" width="100"></vxe-column>
            <vxe-column field="fzcjd" title="支出进度" width="100">
              <template #default="{ row }">
                <span>{{ fzcjdNum(row.fzcjd) }}</span>
              </template>
            </vxe-column>
            <vxe-column field="fbm" title="科室" width="100"></vxe-column>
            <vxe-column title="操作" width="180" fixed="right">
              <template #default="{ row }">
                  <a-form layout="inline" >
                    <a-form-item v-if="Number(row.fzbjy) > 0 && row.parentid == null">
                      <a-button class="blue-btn" @click="editHandele(row)" icon="fork">拆分</a-button>
                    </a-form-item>
                    <a-form-item v-if="row.fsfywqcf == '0'">
                      <a-popconfirm
                          title="您确定要删除这条数据吗?"
                          ok-text="确定"
                          cancel-text="取消"
                          @confirm="deleteHandele(row)"
                          @cancel="cancel"
                          >
                              <a-button class="red-btn" icon="delete">删除</a-button>
                      </a-popconfirm>
                    </a-form-item>
                  </a-form>
              </template>
            </vxe-column>
          </vxe-table>
        <a-pagination
            v-model:current="current"
            style="text-align: right;margin-top: 10px;"
            show-size-changer
            :show-total="total => `共 ${total} 条`"
            :default-current="1"
            :total="total"
            @change="oCurrentChange"
            @showSizeChange="onShowSizeChange"
        />
        <a-modal
          :title="'项目预算指标操作记录'"
          :visible="visible"
          :maskClosable="false"
          :closable="true"
          :destroyOnClose="true"
          width="80%"
          wrapClassName="ysxmzbczjl-modal-Lu"
          :dialog-style="{ margin: '0 auto' }"
          @cancel="visible = false">
          <template slot="footer">
              <a-button class="blue-btn" @click="visible = false">
                  关闭
              </a-button>
          </template>
          <commpVxeTable
              :isCanWrap="true"
              :conditionBtnRow="true"
              :key="reCommpVxeTable"
              :config="dataTableConfig"
              :columns="columnsVxe"
              :formItem="formItem"
              :occupancyHeight="200"
              @checkboxChange="checkboxChange"
              ref="administrativeOffice"
              @searchEvent="searchEvent"
              @resetEvent="resetEvent"
              >
              <template v-slot:fbm_slot="{data}">
                <div :style="{width:data.widthString}">
                    <compSelector
                        :compType="typeSelect"
                        class="comp-select-box-b"
                        @selectHandleChange="fbmChange"
                        dictionaryType="OA申请科室单位"/>
                </div>
              </template>
              <template v-slot:fbmzcjjfl_slot="{data}">
                <div :style="{width:data.widthString}">
                    <a-cascader ref="cascaderBmzcjjfl" :display-render="displayRender" :options="bmJjflList" placeholder="请选择" @change="fbmzcjjflChange" />
                </div>
            </template>
              <template v-slot:externalOperations="{data}"  >
                  <vxe-form-item>
                    <a-button class="blue-btn" @click="exportClick" icon="export">导出</a-button>
                  </vxe-form-item>
              </template>
            </commpVxeTable>
        </a-modal>
        <handleModal ref="handleModalRef" :passObj="passObj"  @success="success"></handleModal>
        <chaiFenModal ref="chaiFenModalRef" :passObj="chaiObj"  @success="success"></chaiFenModal>
    </div>
</template>
<script>
import assessCheckApi from './service/api.js'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import compSelector from '@/components/compSelector/compSelector'
import {typeSelect, } from '@/components/compSearchCriteria/ContractType'
import handleModal from './handleModal'
import chaiFenModal from './chaiFenModal.vue'
import {
    list,
    deleteData,
    deleteBatch,
    etImpInspectorModel,
    impExcelInspectorTBYC,
    exportYszbtzData,
    getbmyszcjjflkm,
    exportYszbczjlData,
    getAllTzJd,
    getTreelists,
    getImpInspectorModel,
} from './service/index.js'
// import { list } from '../../../../pageManagement/service/index.js'
import moment from 'moment'
export default {
  components: {
    commpVxeTable,handleModal,chaiFenModal,compSelector
  },
  props:{
  },
  data() {
    return {
      reCommpVxeTable: '',
      visible: false,
      moment,
      fysxmmc: '',
      ledgerTableHeight: window.innerHeight - 295 - 55 - 48,
      dataTableConfig: {
        api: assessCheckApi.getIdByczjl,
        rowId: 'id',
        urlType: true,
        paramet:{
          fyszbid: ''
        }
      },
      formItem: [
        {
            label: '预算指标名称',
            model: 'fyszbmc',
        },{
            label: '操作人',
            model: 'fczr',
        },{
            label: '操作部门',
            model: 'fczbm',
            slotName:'fbm_slot',
            width:125,
        },{
            label: '部门支出经济分类',
            model: 'fbmzcjjfl',
            slotName:'fbmzcjjfl_slot',
            width:125,
        },{
            label: '支付时间',
            model: ['startTime','endTime'],
            type: 'rangePicker',
            format: 'YYYY年MM月DD日 HH时mm分ss秒',
        },
      ],
      columnsVxe: [
          {
              type: 'checkbox',
              width: 60 ,
              fixed: 'left'
          },{
            title: '预算指标名称',
            field: 'fyszbmc',
            fixed:'left'
          },{
            title: '部门支出经济分类',
            field: 'fbmzcjjfl',
          },{
            title: '操作人',
            field: 'fczr',
            width: 100,
          },{
            title: '操作部门',
            field: 'fczbm',
          },{
            title: '操作时间',
            field: 'fczsj',
          },{
            title: '操作方式',
            field: 'fczfs',
            width: 100,
          },{
            title: '关联单据摘要',
            field: 'fgldjzy',
          },{
            title: '收支类型',
            field: 'fszlx',
            width: 100,
          },{
            title: '操作金额',
            field: 'fczje',
            width: 100,
          },
        ],
      idList: [],
      passObj: {},
      chaiObj: {},
      tableData: [],
      loading: false,
      expandedRowKeys: [],
      selectedRowKeys: [], // Check here to configure the default column
      typeSelect:typeSelect,
      compSelectorkey:null,
      form: this.$form.createForm(this, { name: 'cform' }),
      formState: {
        pageSize: 10,
      },
      createValue: [],
      bmJjflList: [],
      zfJjflList: [],
      total: 0,
      current: 1,
      tzjdData: {},
      tzjdDataPage: {}
    }
  },
  mounted() {
    this.getData()
    this.getBmJjfl()
    this.getZfJjfl()
    this.getAllTzJdFuntion()
    this.getTreelistsFuntion()
  },
  created(){},
  methods: {
    oCurrentChange(current) {
      //console.log(current);
      this.current = current
      this.getData({pageNo:current})
    },
    onShowSizeChange(current, pageSize) {
      //console.log(current, pageSize);
      this.formState.pageSize = pageSize
      this.getData({pageNo: 0})
    },
    getData(val){
        this.loading = true;
        let data = this.formState
        data = {
          ...data,
          ...val
        }
        list(data).then(res => {
            // this.tableData = res.result.records
            this.loading = false;
            this.total = res.result.total
            // 持续展开所有，与expandAll: true配合使用
            // this.$nextTick(() => this.$refs.tableRef.setAllTreeExpand(true));
            this.tableData = []
            res.result.records.forEach(item => {
              // if(!item.children){
              //   this.tableData.push(item)
              // }
              this.tableData.push(item)
              if(item.children){
                item.children.forEach(items => {
                  this.tableData.push(items)
                })
              }
            })
            //console.log('新数组：',this.tableData)
        })
        // return this.tableData
        this.getTreelistsFuntion()
    },
    getBmJjfl(){
      getbmyszcjjflkm({kmlx: '部门支出经济分类'}).then(res => {
        this.bmJjflList = []
        res.result.records.forEach(item => {
          item = {
            ...item,
            label: item.kmmc + '(' + item.kmdm + ')',
            value: item.kmdm
          }
          if (item.children && item.children.length > 0) {
            item.children = item.children.map(items=> {return{...items,label: items.kmmc + '(' + items.kmdm + ')',value: items.kmdm}})
          }
          this.bmJjflList.push(item)
        })
        // const flattenedArray = this.flattenTreeData(res.result.records);
        // this.bmJjflList = flattenedArray
        //console.log('部门支出经济分类:',this.bmJjflList)
      })
    },
    getZfJjfl(){
      getbmyszcjjflkm({kmlx: '政府支出经济分类'}).then(res => {
        this.zfJjflList = []
        res.result.records.forEach(item => {
          item = {
            ...item,
            label: item.kmmc + '(' + item.kmdm + ')',
            value: item.kmdm
          }
          if (item.children && item.children.length > 0) {
            item.children = item.children.map(items=> {return{...items,label: items.kmmc + '(' + items.kmdm + ')',value: items.kmdm}})
          }
          this.zfJjflList.push(item)
        })
      })
    },
    getAllTzJdFuntion(){
        getAllTzJd().then(res => {
            if(res.success){
                this.tzjdData = res.result[0]
            }
        })
    },
    getTreelistsFuntion(){
        getTreelists().then(res => {
            if(res.success){
                this.tzjdDataPage = res.result[0]
            }
        })
    },
    flattenTreeData(treeData, result = []) {
      for (let i = 0; i < treeData.length; i++) {
        const node = treeData[i];
        result.push(node); // 将当前节点添加到结果数组中
        if (node.children && node.children.length > 0) {
          this.flattenTreeData(node.children, result); // 递归处理子节点
        }
      }
      return result;
    },
    onBmflChange(value){
      //console.log(value)
      this.formState.fbmjjflbm = value[value.length - 1]
    },
    fbmzcjjflChange(value){
      //console.log(value)
      this.dataTableConfig.paramet = {
        ...this.dataTableConfig.paramet,
        fbmzcjjbm: value[value.length - 1]
      }
    },
    onZfflChange(value){
      //console.log(value)
      this.formState.fzfjjflbm = value[value.length - 1]
    },
    handleChange(value) {
      this.formState.pageSize = value
    },
    displayRender({ labels }) {
      return labels[labels.length - 1];
    },
    clearData(){
        this.formState = {
          pageSize: 10,
        }
        this.current = 1
        this.createValue = []
        this.$refs.cascaderBm.sValue = []
        this.$refs.cascaderZf.sValue = []
        //console.log('清空后：',this.formState)
        // this.getData({pageNo:this.current})
        this.oCurrentChange(this.current)
        this.getTreelistsFuntion()
    },
    expandIcon(props){
        if (props.record.children){
          if(props.record.children.length > 0){
            if (props.expanded) {
              return <a style="margin-right:0px" onClick={e=> {
                props.onExpand(props.record, e);
              }}><a-icon type="caret-down"/> </a>
            } else{
              return <a style="margin-right:0px" onClick={e => {
                props.onExpand(props.record, e);
              }}><a-icon type="caret-right"/></a>
            }
          }else{
            return <span style="margin-right:0px"></span>
          }
        }
      },
    // onSelectChange(selectedRowKeys,selectedRows) {
    //   //console.log(selectedRowKeys,selectedRows);
    //   this.selectedRowKeys = selectedRowKeys;
    //   this.idList = []
    //   if(selectedRows.length){
    //     selectedRows.forEach(item => {
    //         this.idList.push(item.id)
    //     });
    //   }
    // },
    selectChangeEvent(val){
        //console.log('当前选择',val.records)
        if(val.records.length){
            val.records.forEach(item => {
                this.idList.push(item.id)
            });
        } else {
            this.idList = []
        }
    },
    selectAllChangeEvent(val){
        //console.log('当前全部选择',val.records)
    },
    // 勾选
    checkboxChange(val){
      //console.log('已选择',val)
      this.idList = []
      if(val.length){
        val.forEach(item => {
            this.idList.push(item.id)
        });
      }
    },
    onChange(date, dateString) {
      //console.log(date, dateString);
      this.createValue = date
      this.formState.fkssj = dateString[0]
      this.formState.fjssj = dateString[1]
    },
    fbmChange(val){
      this.dataTableConfig.paramet = {
        ...this.dataTableConfig.paramet,
        fczbm: val
      }
    },
    // 搜索
    searchEvent(){
      this.dataTableConfig.paramet = {
          ...this.dataTableConfig.paramet,
      }
      //console.log(this.dataTableConfig.paramet)
    },
    // 重置
    resetEvent(){
      this.dataTableConfig.paramet = {
        fyszbid: this.dataTableConfig.paramet.id,
      }
      this.reCommpVxeTable = Date.now()
      this.$refs.cascaderBmzcjjfl.sValue = []
    },
    // 添加
    addHandele(){
        this.passObj = {
            title: '添加'
        }
        this.$nextTick(_ => {
            this.$refs.handleModalRef.handleModalVisible = true
        })
    },
    // 编辑
    editHandele(row){
        this.chaiObj = {
            title: row.fysxmmc + '指标拆分',
            valueData: row
        }
        this.$nextTick(_ => {
            this.$refs.chaiFenModalRef.handleModalVisible = true
        })
    },
    // 删除
    deleteHandele(row){
        deleteData({id:row.id}).then(res => {
            if(res.code == 200){
                this.$message.success(res.message)
                // this.reCommpVxeTable = Date.now()
                this.clearData()
            } else {
                this.$message.warning(res.message)
            }
        })
    },
    // 批量删除
    deleteBatchHandele(){
        let that = this
        if(that.idList.length == 0){
            that.$message.warning('请选择删除项目')
        } else {
            that.$confirm({
                title: '您确定要删除这些数据吗?',
                content: '',
                okText: '确定',
                okType: 'danger',
                cancelText: '取消',
                onOk() {
                    let list = that.idList.toString()
                    //console.log(list)
                    deleteBatch({ids:list}).then(res => {
                        //console.log(res)
                        if(res.code == 200){
                            // that.reCommpVxeTable = Date.now()
                            that.clearData()
                            that.$message.success(res.message)
                        } else {
                            that.$message.warning(res.message)
                        }
                    })
                },
                onCancel() {
                    //console.log('Cancel');
                },
            });
        }
    },
    // 下载模板
    downloadModel(){
        let that = this
        that.$confirm({
            title: '您确定要下载当前模板吗?',
            content: '',
            okText: '确定',
            okType: 'info',
            cancelText: '取消',
            onOk() {
                var fileName = '预算指标台账模板'
                getImpInspectorModel().then((data) => {
                    if (!data) {
                        that.$message.warning('文件下载失败')
                        return
                    }
                    if (typeof window.navigator.msSaveBlob !== 'undefined') {
                        window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
                    } else {
                        let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
                        let link = document.createElement('a')
                        link.style.display = 'none'
                        link.href = url
                        link.setAttribute('download', fileName + '.xls')
                        document.body.appendChild(link)
                        link.click()
                        document.body.removeChild(link) //下载完成移除元素
                        window.URL.revokeObjectURL(url) //释放掉blob对象
                    }
                })
            },
            onCancel() {
                //console.log('Cancel');
            },
        });
    },
    beforeUpload(e){
        return false
    },
    // 导入
    importHandele({file}){
        var that = this
        if(typeof file.uid !== 'undefined') {
            // if(file.name.indexOf(".xls") !== -1 || file.name.indexOf(".xlsx") !==-1) {
            const fileData = new FormData();
            fileData.append("file",file);
            //console.log('fileData',fileData)
            impExcelInspectorTBYC(fileData).then(res => {
                if(res.code == 200){
                    that.$message.success(res.message)
                    // that.reCommpVxeTable = Date.now()
                    that.clearData()
                } else {
                    that.$message.warning(res.message)
                }
            })
            // }
        }
    },
    // 导出
    exportHandele(){
        let that = this
        if(that.idList.length == 0){
            that.$message.warning('请选择导出项')
        } else {
            that.$confirm({
                title: '您确定要导出这些数据吗?',
                content: '',
                okText: '确定',
                okType: 'info',
                cancelText: '取消',
                onOk() {
                    var fileName = '预算指标台账数据'
                    let list = that.idList.toString()
                    exportYszbtzData({ids: list}).then((data) => {
                        // //console.log(data)
                        if (!data) {
                            that.$message.warning('文件下载失败')
                            return
                        }
                        if (typeof window.navigator.msSaveBlob !== 'undefined') {
                            window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
                        } else {
                            let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
                            let link = document.createElement('a')
                            link.style.display = 'none'
                            link.href = url
                            link.setAttribute('download', fileName + '.xls')
                            document.body.appendChild(link)
                            link.click()
                            document.body.removeChild(link) //下载完成移除元素
                            window.URL.revokeObjectURL(url) //释放掉blob对象
                        }
                    })
                },
                onCancel() {
                    //console.log('Cancel');
                },
            });
        }
    },
    fzcjdNum(num){
        if(num){
            var number = Number(num * 100).toFixed(2) + '%'//保留两位小数
            return number
        }
    },
    viewChaiLogs(row){
      //console.log(row)
      this.visible = true
      this.dataTableConfig.paramet.fyszbid = row.id
      this.reCommpVxeTable = Date.now()
    },
    exportClick(){
      let that = this
        if(that.idList.length == 0){
            that.$message.warning('请选择导出项')
        } else {
            that.$confirm({
                title: '您确定要导出这些数据吗?',
                content: '',
                okText: '确定',
                okType: 'info',
                cancelText: '取消',
                onOk() {
                    var fileName = '项目预算指标操作记录'
                    let list = that.idList.toString()
                    exportYszbczjlData({ids: list}).then((data) => {
                        // //console.log(data)
                        if (!data) {
                            that.$message.warning('文件下载失败')
                            return
                        }
                        if (typeof window.navigator.msSaveBlob !== 'undefined') {
                            window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
                        } else {
                            let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
                            let link = document.createElement('a')
                            link.style.display = 'none'
                            link.href = url
                            link.setAttribute('download', fileName + '.xls')
                            document.body.appendChild(link)
                            link.click()
                            document.body.removeChild(link) //下载完成移除元素
                            window.URL.revokeObjectURL(url) //释放掉blob对象
                        }
                    })
                },
                onCancel() {
                    //console.log('Cancel');
                },
            });
        }
    },
    cancel(){},
    // 弹窗提交成功
    success(){
      // 刷新表格 清空id数组
    //   this.$refs.administrativeOffice.searchEvent()
        this.clearData()
        this.idList = []
    },
  },
}
</script>
<style lang="less">
.ledgerTable {
  .ant-table.ant-table-bordered .ant-table-title {
    border: 1px solid #d9d9d9;
  }
  thead tr th {
    // color: #606266;
    background: #dee5ed !important;
    height: 42.5px !important;
    color: #000 !important;
    padding: 0px !important;
    text-align: center;
  }
  tbody tr {
    text-align: center;
    height: 42.5px !important;
    td {
      padding:  0px !important;
      height: 42.5px !important;
      text-align: center !important;
      overflow-wrap: break-word !important;
    }
  }
  // .ant-table-fixed-left {
  //   // position: fixed;
  //   height: 100%;
  //   .ant-table-body-outer {
  //     height: 86%;
  //   }
  // }
  // tbody tr:nth-child(even)  {
  //   background-color: #f0f0f1 !important;
  // }
}
.internalControl-budget-ledger-form-box {
  border: 1px solid #d9d9d9;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 3px;
  margin:8px !important;
  .ant-form .ant-form-item{
      padding: 0;
      padding-bottom: 0px;
      padding-right: 5px;
      margin: 0 !important;
      width: 25%;
      .ant-form-item-label {
        width: 30% !important;
      }
      .ant-form-item-control-wrapper {
        width: 70% !important;
      }
  }
  .comp-select-box-b{
      .ant-select {
        width: 100% !important;
      }
    .ant-checkbox-group-item {
      width: 100% !important;
      // margin-left: 5px;
      // margin-bottom: 5px;
      margin: 10px;
    }
  }
  .ant-form-inline .ant-form-item>.ant-form-item-control-wrapper {
    vertical-align: middle !important;
  }
}
.internalControl-budget-ledger-div-box {
  .col--ellipsis{
        overflow: hidden !important;
    }
    .vxe-table--header-wrapper {
      // height: 40px !important;
      color: #000 !important;
      font-family: 仿宋_GB2312 !important;
      font-weight: 600 !important;
      background: #dee5ed !important;
    }
    .vxe-table--render-default .vxe-cell{
        padding: 0 10px !important;
        text-align: center;
    }
    td,th{
        padding: 7px 0px !important;
    }
    tr:nth-child(even)  {
      background-color: #f0f0f1 !important;
    }
}
.ysxmzbczjl-modal-Lu {
    .comp-select-box-b{
        .ant-select {
            width: 100% !important;
        }
        .ant-checkbox-group-item {
            width: 100% !important;
            // margin-left: 5px;
            // margin-bottom: 5px;
            margin: 10px;
        }
    }
}
</style>
